/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lifecraft;

import org.lwjgl.opengl.GL11;

/**
 *
 * @author oem
 */
public class Equipment {
    
    public class Quick {
        public SurfC ID = SurfC.AIR;
        public int x;
        public int y;
    }
   
    
   
   final private int Q_WIDTH = 70;
   //przechowywuje ID klockow i x,y
   Quick[] quick = new Quick[10];
   public int quick_choice = 0;
    
   Equipment(){
       
      
   
      int x = 10;
      int y = 80;
      boolean change = true;
      for (int i=0;i<10;i++){
          
          quick[i] = new Quick();
          quick[i].x = x;
          quick[i].y = y;
      
          if(change){
              x += (Q_WIDTH/2 + 2);
              y -=  (Q_WIDTH/2 + 2);
              change = false;
          }
          else{
              x += (Q_WIDTH/2 + 2);
              y +=  (Q_WIDTH/2 + 2);
              change = true;
          }         
      }  
      quick[0].ID = SurfC.DIRT;
      quick[1].ID = SurfC.STONE;
      quick[2].ID = SurfC.WATER;
      quick[3].ID = SurfC.GRASS;
   }
   
   
   public void romb(int x, int y, int w, int i){
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       if(i == quick_choice) GL11.glColor4f(1.f, 1f, 0.5f, 0.5f);
       else GL11.glColor4f(1.f, 0.5f, 1.f, 0.5f);
           
       GL11.glBegin(GL11.GL_QUADS);
           GL11.glVertex2f(x, y);
           GL11.glVertex2f(x+w/2, y + w/2);
           GL11.glVertex2f(x+w,y);   
           GL11.glVertex2f(x+ w/2,y - w/2);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
   
        if(quick[i].ID.ordinal() != 0){
            SurfaceBase.get().getFromID(quick[i].ID).useLight(x + (w/2) - 16, y +16, 32, -32, 0, 0, 1);
        }
        
   }
    
    
    public void renderQuick(){
         
         for(int i=0;i<10;i++){
             romb(quick[i].x,quick[i].y,Q_WIDTH,i);
         }
                
         
        
    }
}
